package com.app.mapper.authority;

import com.app.entity.Menu;
import com.app.entity.authority.Role;
import com.app.entity.authority.RoleMenuRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by lijun on 2018/2/22.
 */

@Mapper
public interface RoleMapper {

    //currentItem
    //pageSize

    List<Role> getList(@Param("currentItem") Integer currentItem, // Pagination _page,
                       @Param("pageSize") Integer pageSize,

                       @Param("searchName") String searchName,
                       @Param("orderName") String orderName,
                       @Param("orderKind") String orderKind
    );

    int getListSize(@Param("currentItem") Integer currentItem, // Pagination _page,
                    @Param("pageSize") Integer pageSize,
                    @Param("searchName") String searchName);

    //增    角色
    Integer insertRole(Role _role);

    //增    权限
    Integer insertPower(List<RoleMenuRelation> _relation);

    //根据ID获取list
    List<Role>getModifyInfo(Role _role);

    //改    角色
    Integer updateRoleList(Role _role);

    //改    权限
    Integer updatePower(List<RoleMenuRelation> _relation);

    //删    角色
    Integer delRoleList(Role _role);

    //删    权限
    Integer delRolePower(Role _role);

    //查重复CODE
    List<Role> validateLevelCode(Role _role);

    //新角色权限   addrole
    List<Menu>getPowerModel(String parentId);

    List<Menu>getPowerModelByRoleId(@Param("roleId") String roleId,
                                    @Param("parentId") String parentId);
}
